﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using FinalProject.Data.Search;

namespace FinalProject.Data.DBInteractions.Interfaces
{
    public interface IEntityRepository<T> where T : class
    {
        void Add(T entity);
        void Update(T entity);
        void Delete(T entity);
        void Delete(Func<T, Boolean> predicate);
        PagedListResult<T> Search(SearchQuery<T> searchQuery);
        PagedListResult<T> GetTheResult(SearchQuery<T> searchQuery, IQueryable<T> sequence);
        IQueryable<T> ManageSortCriterias(SearchQuery<T> searchQuery, IQueryable<T> sequence);
        IQueryable<T> ManageFilters(SearchQuery<T> searchQuery, IQueryable<T> sequence);
        IQueryable<T> ManageIncludeProperties(SearchQuery<T> searchQuery, IQueryable<T> sequence);
        T GetById(long id);
        T Get(Func<T, bool> where);
        void Attach(T entity);
        void LoadNavigationCollection<TElement>(T entity,
            Expression<Func<T, ICollection<TElement>>> navigationProperty)
            where TElement : class;
    }
}